Auto merge of #5112 - Eh2406:cache_queries, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 3 Mar 2018 21:32:24 +0000 (21:32 +0000)
committerbors <bors@rust-lang.org>
Sat, 3 Mar 2018 21:32:24 +0000 (21:32 +0000)
Cache the query result.

Small performance gain.

In a test on https://github.com/rust-lang/cargo/issues/4810#issuecomment-357553286
Before we got to 1700000 ticks in ~97 sec
After we got to 1700000 ticks in ~92 sec. I just reran and got ~82, so it seems to be unstable.
And query disappears from the flame graph


Trivial merge